<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:a="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>

    <h:form id="historico" styleClass="edit">
    
        <rich:panel>
            <f:facet name="header">#{historicoHome.managed ? 'Edit' : 'Add'} Historico</f:facet>

            <s:decorate id="idtHistoricoDecoration" template="layout/edit.xhtml">
                <ui:define name="label">idtHistorico</ui:define>
                <h:inputText id="idtHistorico"
                       required="true"
                       disabled="#{historicoHome.managed}"
                          value="#{historicoHome.instance.idtHistorico}">
                    <a:support event="onblur" reRender="idtHistoricoDecoration" bypassUpdates="true"/>
                </h:inputText>
            </s:decorate>
        
            <div style="clear:both">
                <span class="required">*</span> 
                required fields
            </div>
            
        </rich:panel>
                
        <div class="actionButtons">

            <h:commandButton id="save" 
                          value="Save" 
                         action="#{historicoHome.persist}"
                       disabled="#{!historicoHome.wired}"
                       rendered="#{!historicoHome.managed}"/>  
                          			  
            <h:commandButton id="update" 
                          value="Save" 
                         action="#{historicoHome.update}"
                       rendered="#{historicoHome.managed}"/>
                        			  
            <h:commandButton id="delete" 
                          value="Delete" 
                         action="#{historicoHome.remove}"
                       rendered="#{historicoHome.managed}"/>
                    
            <s:button id="done" 
                   value="Done"
             propagation="end"
                    view="/Historico.xhtml"
                rendered="#{historicoHome.managed}"/>
                
            <s:button id="cancel" 
                   value="Cancel"
             propagation="end"
                    view="/#{empty historicoFrom ? 'HistoricoList' : historicoFrom}.xhtml"
                rendered="#{!historicoHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">
    
    <rich:tab label="curso *" labelClass="required">
    <div class="association" id="cursoParent">
    
        <h:outputText value="No curso" 
                   rendered="#{historicoHome.instance.curso == null}"/>
        
        <rich:dataTable var="curso" 
                   value="#{historicoHome.instance.curso}" 
                rendered="#{historicoHome.instance.curso != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="cursoTable">
            <h:column>
                <f:facet name="header">idtCurso</f:facet>
                #{curso.idtCurso}
            </h:column>
            <h:column>
	    	    <f:facet name="header">campus idtCampus</f:facet>
		    	#{curso.campus.idtCampus}
            </h:column>
            <h:column>
                <f:facet name="header">nomCurso</f:facet>
                #{curso.nomCurso}
            </h:column>
            <h:column>
                <f:facet name="header">desCurso</f:facet>
                #{curso.desCurso}
            </h:column>
            <h:column>
                <f:facet name="header">numDuracao</f:facet>
                #{curso.numDuracao}
            </h:column>
            <h:column>
                <f:facet name="header">indTipoDuracao</f:facet>
                #{curso.indTipoDuracao}
            </h:column>
            <h:column>
                <f:facet name="header">action</f:facet>
                <s:link view="/Curso.xhtml" 
                         id="viewcurso" 
                      value="View" 
                propagation="none">
                    <f:param name="cursoIdtCurso" 
                           value="#{curso.idtCurso}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button value="Select curso"
                       view="/CursoList.xhtml">
                <f:param name="from" value="HistoricoEdit"/>
            </s:button>
        </div>
        
    </div>
    </rich:tab>
    
    <rich:tab label="aluno *" labelClass="required">
    <div class="association" id="alunoParent">
    
        <h:outputText value="No aluno" 
                   rendered="#{historicoHome.instance.aluno == null}"/>
        
        <rich:dataTable var="aluno" 
                   value="#{historicoHome.instance.aluno}" 
                rendered="#{historicoHome.instance.aluno != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="alunoTable">
            <h:column>
                <f:facet name="header">idtAluno</f:facet>
                #{aluno.idtAluno}
            </h:column>
            <h:column>
                <f:facet name="header">numRa</f:facet>
                #{aluno.numRa}
            </h:column>
            <h:column>
                <f:facet name="header">nomAluno</f:facet>
                #{aluno.nomAluno}
            </h:column>
            <h:column>
                <f:facet name="header">numRg</f:facet>
                #{aluno.numRg}
            </h:column>
            <h:column>
                <f:facet name="header">numCpf</f:facet>
                #{aluno.numCpf}
            </h:column>
            <h:column>
                <f:facet name="header">datNascimento</f:facet>
                #{aluno.datNascimento}
            </h:column>
            <h:column>
                <f:facet name="header">action</f:facet>
                <s:link view="/Aluno.xhtml" 
                         id="viewaluno" 
                      value="View" 
                propagation="none">
                    <f:param name="alunoIdtAluno" 
                           value="#{aluno.idtAluno}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button value="Select aluno"
                       view="/AlunoList.xhtml">
                <f:param name="from" value="HistoricoEdit"/>
            </s:button>
        </div>
        
    </div>
    </rich:tab>

    <rich:tab label="historicoItems">
        <div class="association" id="historicoItemsChildren">
        
            <h:outputText value="No historicoItems" 
                       rendered="#{empty historicoHome.historicoItems}"/>
        
            <rich:dataTable value="#{historicoHome.historicoItems}" 
                           var="historicoItem" 
                      rendered="#{not empty historicoHome.historicoItems}" 
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="historicoItemsTable">
                <h:column>
                    <f:facet name="header">indHistorico</f:facet>
                    #{historicoItem.id.indHistorico}
                </h:column>
                <h:column>
                    <f:facet name="header">indGradeCurricular</f:facet>
                    #{historicoItem.id.indGradeCurricular}
                </h:column>
                <h:column>
                    <f:facet name="header">indDisciplina</f:facet>
                    #{historicoItem.id.indDisciplina}
                </h:column>
                <h:column>
                    <f:facet name="header">numNota</f:facet>
                    <h:outputText value="#{historicoItem.numNota}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">numFalta</f:facet>
                    <h:outputText value="#{historicoItem.numFalta}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">action</f:facet>
                    <s:link view="/HistoricoItem.xhtml" 
                              id="selecthistoricoItem" 
                           value="Select"
                     propagation="none">
                        <f:param name="historicoItemIndHistorico" 
                                value="#{historicoItem.id.indHistorico}"/>
                        <f:param name="historicoItemIndGradeCurricular" 
                                value="#{historicoItem.id.indGradeCurricular}"/>
                        <f:param name="historicoItemIndDisciplina" 
                                value="#{historicoItem.id.indDisciplina}"/>
                        <f:param name="historicoItemFrom" value="Historico"/>
                    </s:link>
                </h:column>
            </rich:dataTable>
        
        </div>
          
        <f:subview rendered="#{historicoHome.managed}" id="historicoItems">
        <div class="actionButtons">
            <s:button id="addhistoricoItem" 
                   value="Add historicoItem"
                    view="/HistoricoItemEdit.xhtml"
             propagation="none">
                 <f:param name="historicoIdtHistorico" 
                         value="#{historicoHome.instance.idtHistorico}"/>
                 <f:param name="historicoItemFrom" value="Historico"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
